<!doctype html>
<html>
{include file="head.html"}

<body>
  <div class="fullscreen">
  <div class="scroll_contentx">
    <div class="topfixed">
      <div class="t_left"><a href="/index.php" class="goBack"><i class="back"></i></a></div>
      <div class="t_main" >{if $cat}{$cat.cname}{else}全部商家{/if}</div>
      <div class="t_right"><div class="ico_search" id="cl-search"></div></div>
    </div>
    <div class="paddingheight"></div>
 
     
    
    <div class="search-box" id="search-box">
    	<div class="l">
        	<div class="mn">
        	<input type="text" name="keyword" id="keyword" placeholder="请输入商名称">
            </div>
        </div>
        <div class="r"><button class="btn" type="button" id="search-submit">搜索</button></div>
    </div>
    
    <script>
    
	
	$(document).on("click","#cl-search",function(){
		$("#search-box").toggle();
		 
	});
	 
	$(document).on("click","#search-submit",function(){
		window.location='/index.php?m=shoplistall&keyword='+$("#keyword").val();
	});
    </script>
    
     
    {php $this->_var['orderbys']=array('default'=>"智能排序",'distance'=>'距离最近','sold_num'=>'销量最高','raty_grade'=>'评价最好');}
    {php $this->_var['filters']=array('cspf'=>'超时赔付','isnew'=>'新店');}
    <div style="position:relative;">
    <div class="tab-select i3">
    		<div class="item" id="tab-category"><span class="t">{if $cat}{$cat.cname}{else}全部商家{/if}</span> <i class="t3down "></i><b></b></div>
            
            <div style="display:none;" class="item" id="tab-scarea"><span class="t">{if $scarea}{$scarea['title']}{else}区域{/if}</span> <i class="t3down"></i><b></b></div>
            	
    		<div class="item" id="tab-order"><span class="t">{if get('orderby')}{$orderbys[get('orderby')]}{else}智能排序{/if}</span> <i class="t3down"></i><b></b></div>
    		<div class="item" id="tab-choice"><span class="t">{if get('filter')}{$filters[get('filter')]}{else}筛选{/if}</span> <i class="t3down"></i></div>
    </div>
     
    <div id="category-box" class="category-box tab-select-box">
    	<div class="box1">
        	<div class="pd">
        	{foreach item=c from=$catlist}
        	<div   to="c{$c.catid}" class="box1item   {if $c.catid eq get('catid') or $cat.pid eq $c.catid}active{/if}">{$c.cname}</div>
            
            {/foreach} 
            </div>
        </div>
        <div class="box2">
         <div class="pd">
        	{foreach item=c from=$catlist}
            <div   v="{$c.catid}" class="box2item   c{$c.catid} {if $c.catid eq $c.catid}show{/if} ">{$c.cname}</div>
            {foreach item=cc from=$c.child}
        	<div   v="{$cc.catid}" class="box2item   c{$c.catid} {if $cat.catid eq $c.catid}show{/if} ">{$cc.cname}</div>
            {/foreach}
            {/foreach} 
            </div> 
        </div>
    </div>
    <div id="order-box" class="order-box tab-select-box">
    	<a class="item" v="default">智能排序</a>
        <a class="item" v="distance">距离最近</a>
        <a class="item" v="sold_num">销量最高</a>
        <a class="item" v="raty_grade">评价最好</a>
        
    
    </div>
    
    <div id="scarea-box" class="choice-box tab-select-box">
    	<a class="item" v="">全部</a>
        {foreach item=c from=$sclist}
        <a class="item" v="{$c.sc_id}">{$c.title}</a>
        {/foreach} 
    </div>
    
    <div id="choice-box" class="choice-box tab-select-box">
    	<a class="item" v="">全部</a>
    	<a class="item" v="cspf">超时赔付</a>
        
        <a class="item" v="isnew">新店</a>
    </div>
    
    <div class="flexslider">
      {get data=ad1 model=ad fun=listbyno("wap_shoplist_flash")}
          <ul class="slides clearfix">
          {foreach item=c from=$ad1}
            <li><a href="{$c.link1}"><img class="img" src="{$c.imgurl|images_site}"></a> </li>
          {/foreach}  
           
          </ul>
    </div>
     
      </div>
     <div class="shoplist" id="shoplist">
     	{foreach item=c from=$list}
        
        <div class="item">
        	<a href="/index.php?m=shop&shopid={$c.shopid}">
        	<div class="g-sd1"><img class="img" onerror="err_imgurl(this)" src="{$c.logo|images_site}.100x100.jpg"></div>
            <div class="g-mn1">
            	<div class="g-mn1c">
                	<div class="title"> {$c.shopname} </div>
                    <div class="f2"> 
                    	<span>
                        	<span class="star star{$c.raty_grade|intval}"></span>
                        </span>
                        <span>月销{$c.month_buy}份</span>
                    
                    </div>
                    <div class="f2">{$c.send_startprice}元起送 </div>
                     	
                </div>
            </div>
        	</a>
        </div>
         
        {/foreach}
     
     </div>
    
    <div id="loadmore" class="pullup">加载更多</div>
  </div>
</div>

<script type="text/html" id="shoplist-tpl">
	<%for(var i=0;i<list.length;i++){%>
	<div class="item">
        	<a href="/index.php?m=shop&shopid=<%=list[i].shopid%>">
        	<div class="g-sd1"><img class="img" onerror="err_imgurl(this)" src="<%=images_site(list[i].logo)%>.100x100.jpg"></div>
            <div class="g-mn1">
            	<div class="g-mn1c">
                	<div class="title"> <%=list[i].shopname%> </div>
                    <div class="f2"> 
                    	<span>
                        	<span class="star star<%=parseInt(list[i].raty_grade)%>"></span>
                        </span>
                        <span>月销<%=list[i].month_buy%>份</span>
                    
                    </div>
                    <div class="f2"><%=list[i].send_startprice%>元起送 </div>
                     	
                </div>
            </div>
        	</a>
        </div>
	<%}%>
</script>
<script src="{$skins}js/jquery.flexslider-min.js"></script>
<script src="/plugin/jquery/template-native.js"></script>
 <script src="/plugin/skyweb/listload.js"></script>
<script>
var orderby='',catid=0,filter='',sc_id=0,first=false;; 
var per_page={$per_page};
$(".flexslider").flexslider();
  
function loadShop(){
	if(per_page==0 && !first){		 
		return false; 
	 }
	get(SITE+'/index.php?m=shoplistall&sc_id='+sc_id+'&catid='+catid+"&orderby="+orderby+"&filter="+filter+"&per_page="+per_page,function(data){
		per_page=data.data.per_page;
		if(per_page==0){
			//skyToast('没有数据了');
			$("#loadmore").hide();
		}else{
			$("#loadmore").show();
		}
		var html=template("shoplist-tpl",data.data);
		if(first){
			first=false;
			$("#shoplist").html(html);
			
		}else{
			$("#shoplist").append(html);
		}
	});
}

listload.loadid="#loadmore";
listload.showload(function(){
		loadShop();
 });

$(document).on("click","#tab-category",function(){
 
	$("#category-box").toggle().siblings(".tab-select-box").hide();
	
});

$(document).on("click",".box1item",function(e){
	e.preventDefault();
	
	$(".box1item").removeClass("active");
	$(this).addClass("active");
	$(".box2item").hide();
	$(".box2item."+$(this).attr("to")).css({display:"block"});
});

$(document).on("click",".box2item",function(){
	catid=$(this).attr("v");
	per_page=0;
	first=true;
	$(".box2item").removeClass("active");
	$(this).addClass("active");
	$("#tab-category .t").text($(this).text());
	loadShop();
	$("#category-box").hide();
});

$(document).on("click","#tab-scarea",function(){
 
	$("#scarea-box").toggle().siblings(".tab-select-box").hide();
	 
});

$(document).on("click","#scarea-box .item",function(){
	sc_id=$(this).attr("v");
	$("#scarea-box").hide();
	per_page=0;
	first=true;
	$("#scarea-box .item").removeClass("active");
	$(this).addClass("active");
	$("#tab-scarea .t").text($(this).text());
	loadShop();
});

$(document).on("click","#tab-order",function(){
 
 
	$("#order-box").toggle().siblings(".tab-select-box").hide();
	 
});




$(document).on("click","#order-box .item",function(){
	orderby=$(this).attr("v");
	$("#order-box").hide();
	per_page=0;
	first=true;
	$("#order-box .item").removeClass("active");
	$(this).addClass("active");
	$("#tab-order .t").text($(this).text());
	loadShop();
});

$(document).on("click","#tab-choice",function(){
	$("#choice-box").toggle().siblings(".tab-select-box").hide();
});

$(document).on("click","#choice-box .item",function(){
	filter=$(this).attr("v");
	$("#choice-box").hide();
	$("#tab-choice .t").text($(this).text());
	$("#choice-box .item").removeClass("active");
	$(this).addClass("active");
	per_page=0;
	first=true;
	loadShop();
});

$(".street_list_wrap .list li:odd").css("margin-left","2%");
imgResize(240,240);
		 $(window).resize(function(){
			 imgResize(240,240);
		 })
  </script>
  {assign var="botnav" value="shop"}
 {include file="botnav.html"}
 {include file="footer.html"} 
</body>
</html>
